
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace Jack.EntityFrameworkCore.WebAPITest
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateWebHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateWebHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureLogging((loggingBuilder) =>
                {
                    loggingBuilder.ClearProviders();
                    //loggingBuilder.AddDebug();
                    loggingBuilder.AddConsole();
                    //loggingBuilder.AddFilter(logLevel => true);
                    //loggingBuilder.AddFilter(logLevel => logLevel > LogLevel.Trace);
                    //loggingBuilder.AddFilter("SingleCommandPayloadCreator", LogLevel.Trace);
                    loggingBuilder.AddFilter("Jack.EntityFrameworkCore.WebAPITest.Dapper.Logging.IDbConnectionFactory", LogLevel.Information);
                })
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseStartup<Startup>();
                }).UseAutofac();
    }
}

// https://github.com/ekmadsen/Data
// https://blog.csdn.net/catshitone/article/details/117416716
// https://github.com/hryz/Dapper.Logging
// https://docs.microsoft.com/zh-cn/ef/core/saving/transactions
// https://entityframeworkcore.com/knowledge-base/41399710/how-to-get-current-transaction-from-the-dbcontext
// https://entityframeworkcore.com/knowledge-base/38235541/multiple-databases--multiple-dbcontexts--in-one-transaction-using-transactionscope
// https://entityframeworkcore.com/knowledge-base/48272182/shared-dbcontext-transaction-using-asp-net-core-2-0-mvc-ef
// https://entityframeworkcore.com/knowledge-base/59405072/dapper-and-ef-core-transaction-fails-with-error-sqlconnection-does-not-support-parallel-transactions
